#include "XPlusParseNode.h"


XPlusParseNode::XPlusParseNode()
{
    childs = new XAbstractParseNode *[2];
    childs[0] = nullptr;
    childs[1] = nullptr;
}

XPlusParseNode::~XPlusParseNode()
{
    delete childs[0];
    delete childs[1];
    delete childs;
}

const char *XPlusParseNode::getName() const
{
    return "+";
}

int XPlusParseNode::getCountArgs() const
{
    return 2;
}

void XPlusParseNode::updateValue()
{
    double a;
    childs[0]->updateValue();
    a = childs[0]->getValue();
    
    double b;
    childs[1]->updateValue();
    b = childs[1]->getValue();

    value = a + b;
}